<% content_for :page_title do -%>
  <%= post_title @post -%>
<% end -%>

<%= render @post %>

<ol id="comments" class="commentlist">
  <% @post.approved_comments.each do |comment| -%>
    <li<%=raw cycle(' class="alt"', '') %> id="comment-<%= comment.id %>">
      <%= render comment %>
    </li>
  <% end -%>
</ol>

<div class="related">Looking for more? Head on over to the <%= link_to 'archives', archives_path %>.</div>

<h2>Post a comment</h2>
<% unless @comment.errors.empty? -%>
<div class="errors">
  <h3>Comment not added!</h3>
  <ul>
    <% @comment.errors.sort_by(&:first).each do |error| -%>
      <li><%= format_comment_error(error) %></li>
    <% end -%>
  </ul>
</div>
<% end -%>

<div>
  <%= form_for [@post, @comment], :url => post_comments_path(@post, @comment) do |form| -%>
    <p>
      <%= form.text_field 'author' %>
      <%= form.label :author %>
      <small>Name or <%= link_to 'OpenID', 'http://openidexplained.com/' %> (required)</small>
    </p>
    <p>
      <%= form.text_area 'body' %><br/>
      <small>(<%= link_to 'lesstile enabled', 'http://lesstile.rubyforge.org' %> - surround code blocks with ---)</small>
    </p>
    <p><%= form.submit 'Add Comment' %></p>
  <% end -%>
</div>
